package org.kabeja.dxf.objects;

import org.kabeja.dxf.DXFConstants;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

/**
 * @author shutao
 * @since 2022/4/24 16:52
 */
public class DXFMLineStyle extends DXFObject {
    protected List<DXFMLineStyleElement> lines = new ArrayList<>();
    protected String name = "";
    protected String descrition = "";
    protected int fillColor = 256;
    protected int flags = 0;
    protected double startAngle = 0.0D;
    protected double endAngle = 0.0D;

    public DXFMLineStyle() {
    }

    @Override
    public String getObjectType() {
        return DXFConstants.OBJECT_TYPE_MLINESTYLE;
    }

    public void addDXFMLineStyleElement(DXFMLineStyleElement var1) {
        this.lines.add(var1);
    }

    public DXFMLineStyleElement getDXFMLineStyleLElement(int var1) {
        return this.lines.get(var1);
    }

    public DXFMLineStyleElement removeDXFMLineStyleLElement(int var1) {
        return this.lines.remove(var1);
    }

    public int getDXFMLineStyleLElementCount() {
        return this.lines.size();
    }

    public void sortDXFMLineStyleElements(Comparator var1) {
        Collections.sort(this.lines, var1);
    }

    public String getName() {
        return this.name;
    }

    public void setName(String var1) {
        this.name = var1;
    }

    public String getDescrition() {
        return this.descrition;
    }

    public void setDescrition(String var1) {
        this.descrition = var1;
    }

    public int getFillColor() {
        return this.fillColor;
    }

    public void setFillColor(int var1) {
        this.fillColor = var1;
    }

    public int getFlags() {
        return this.flags;
    }

    public void setFlags(int var1) {
        this.flags = var1;
    }

    public double getStartAngle() {
        return this.startAngle;
    }

    public void setStartAngle(double var1) {
        this.startAngle = var1;
    }

    public double getEndAngle() {
        return this.endAngle;
    }

    public void setEndAngle(double var1) {
        this.endAngle = var1;
    }

    public boolean isFilled() {
        return (this.flags & 1) == 1;
    }

    public boolean hasStartSquareCaps() {
        return (this.flags & 16) == 16;
    }

    public boolean hasStartRoundCaps() {
        return (this.flags & 64) == 64;
    }

    public boolean hasStartInnerArcs() {
        return (this.flags & 32) == 32;
    }

    public boolean hasEndSquareCaps() {
        return (this.flags & 256) == 256;
    }

    public boolean hasEndRoundCaps() {
        return (this.flags & 1024) == 1024;
    }

    public boolean hasEndInnderArcs() {
        return (this.flags & 512) == 512;
    }

    public boolean showMiters() {
        return (this.flags & 2) == 2;
    }
}
